package com.kylin.common.core.exception;

import com.kylin.common.core.beans.ResultCode;

/**
 * 基础异常
 * @author wuhao
 * @version 1.0 - 2021/11/4
 */
public class BaseException extends RuntimeException{

    /**
     * 错误码
     */
    private final int code;

    public BaseException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(ResultCode resultCode){
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public int getCode(){
        return code;
    }
}
